package com.mago.tis.serviceImpl;

import com.mago.tis.bean.LoginBean;
import com.mago.tis.dao.ILoginDao;
import com.mago.tis.daoImpl.LoginDao;
import com.mago.tis.service.ILoginService;
import com.mago.tis.utility.EncryptionDecryption;

public class LoginService extends BaseService implements ILoginService {

	/**
	 * Method to check the login 
	 */
	public boolean login(LoginBean loginBean) {
		boolean isAuthenticated = false;
		try {
			
			// Encrypt the user entered password
			String encodedPassword = EncryptionDecryption.encrypt(loginBean
					.getPassword());
			
			// Call DAO Layer
			ILoginDao loginDao = new LoginDao();
			isAuthenticated = loginDao.checkAuthentication(loginBean.getName(),
					encodedPassword);
		} catch (Exception e) {

		}
		return isAuthenticated;
	}

}
